<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@ page language="java" import="java.util.*" pageEncoding="utf-8" %>
<%@ include file="/common/taglibs.jsp" %>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>能源管理</title>
    <%@ include file="/common/util.jsp" %>
    <script type="text/javascript">

        function jumpPage(pageIndex) {
            window.location.href = "${cdnctx}/system/customerinfo/customerList.shtml?pageIndex=" + pageIndex + "&" + $.param($("#searchLoginForm").serializeObject());
        }
        function addcustomer() {
            document.getElementById("file").click();
        }
        function fileSelected() {
            var formData = new FormData($("#form_file")[0]);
            var filename = $("#file").val();
            console.log("文件名" + filename);
            $("#uploadsuccess").hide();
            if (filename != '') {
                $('#loading').show();
                $.ajax({
                    url: '${cdnctx}/system/customerinfo/inputCustomerInfo.shtml',
                    data: formData,
                    type: "post",
                    async: true,
                    cache: false,
                    contentType: false,
                    processData: false,
                    dataType: "json",
                    success: function (data) {
                        if (data) {
                            $("#uploadsuccess").show();
                            $('#loading').hide();
                        } else {
                            $('#loading').hide();
                            $('#uploaderror').show();
                        }
                    }
                })
            }
        }

        function cleanForm() {
            $('#companyCode').val('');
            $('#customerName').val('');
        }
    </script>
</head>
<body class="main">
<div class="-frame -style -luster" id="css_container">
    <!--首页框架页眉部分↓-->
    <%@ include file="/WEB-INF/pages/inc/header.jsp" %>
    <!--首页框架页眉部分↑-->

    <div class="content">

        <!-- Left导航菜单◎开始 -->
        <%@ include file="/WEB-INF/pages/inc/leftmenu.jsp" %>
        <!-- Left导航菜单◎结束 -->

        <div class="main-mid">
            <div class="pos"><img src="${cdnctx}/src/index/img/index.png"><a
                    href="${cdnctx}/system/customerinfo/customerList.shtml">能源管理 </a></div>
            <div class="css_contentDiv">
                <div class="searchArea b-border-radius" style="padding:10px;">
                    <form id="searchLoginForm" action="${cdnctx}/system/customerinfo/customerList.shtml" method="post">
                        <label class="search_text">公司番号：</label>
                        <input id="companyCode" name="companyCode" type="text" class="search_input"
                               value="${companyCode}"/>
                        &nbsp;&nbsp;&nbsp;&nbsp;
                        <label class="search_text">公司名称：</label>
                        <input id="customerName" name="customerName" type="text" class="search_input"
                               value="${customerName}"/>
                        &nbsp;&nbsp;&nbsp;&nbsp;
                        <input type="submit" class="search_btn" value="查&nbsp;询"/>
                        <input type="button" onclick="cleanForm()" class="reset_btn" value="重&nbsp;置"/>
                        <%--<input type="button" class="add_btn" onclick="addcustomer();" value="导入用户"/>&nbsp;&nbsp;&nbsp;--%>
                        <span id="uploadsuccess" style="display:none;font-size: 14px;font-weight: bold">上传成功！</span>
                        <span id="loading" style="display:none;font-size: 14px;font-weight: bold">数据上传中,请稍等...</span>
                        <span id="uploaderror" style="display:none;font-size: 14px;font-weight: bold">上传失败！</span>
                    </form>
                    <form id="form_file" method="post" enctype="multipart/form-data">
                        <input type="file" id="file" name="file" onchange="fileSelected();" style="display: none">
                    </form>
                </div>

                <div class="detailDiv">
                    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="list_table">
                        <thead>
                        <tr>
                            <td>公司番号</td>
                            <td>公司名</td>
                            <td>项目实施</td>
                            <%--<td>数据采集</td>--%>
                            <td>区域管理</td>
                            <%--<td>设备状态</td>--%>
                            <td>运营维护</td>
                        </tr>
                        </thead>
                        <c:if test="${empty(customerInfoList) }">
                            <tr class="even" align="center" style="color:red">
                                <td colspan="8" class="no-data" style="height: 300px;"></td>
                            </tr>
                        </c:if>
                        <c:if test="${not empty(customerInfoList) }">
                            <c:forEach items="${customerInfoList}" var="entity" varStatus="status">
                                <tr>
                                    <td>${entity.companycode}</td>
                                    <td>${entity.customername}</td>
                                    <td><a href="${cdnctx}/business/init.shtml?companycode=${entity.companycode}">详情</a>
                                    </td>
                                        <%--<td>--%>
                                        <%--<a href="${cdnctx}/economicBenefit/EconomicBenefitFth.shtml?companycode=${entity.companycode}">详情</a>--%>
                                        <%--</td>--%>
                                    <td>
                                        <a href="${cdnctx}/energy/AreaEnergy.shtml?customerinfoid=${entity.id}">详情</a>
                                    </td>
                                        <%--<td>--%>
                                        <%--<a href="${cdnctx}/economicBenefit/devicestatus.shtml?companycode=${entity.companycode}">详情</a>--%>
                                        <%--</td>--%>
                                    <td><a href="${cdnctx}/operate/operatelist.shtml?customerinfoid=${entity.id}">查看</a>
                                    </td>
                                </tr>
                            </c:forEach>
                        </c:if>
                    </table>
                </div>
                <c:if test="${not empty(customerInfoList) }">
                    <div id="pageInfo" class="pageJump">
                        <script type="text/javascript">
                            pagination.getPaginationHtml('JavaScript:jumpPage({0})', ${pageIndex}, ${pageCount}, 'pageInfo');
                        </script>
                        <c:if test="${!empty(customerInfoList) }">
                            共有${dataCount}条数据
                        </c:if>
                    </div>
                </c:if>
            </div>
        </div>

    </div>

    <!--首页框架页尾部分↓-->
    <%@ include file="/WEB-INF/pages/inc/footer.jsp" %>
    <!--首页框架页尾部分↑-->
</div>
</body>
</html>